package com.dyp.configurationpropertiesdemo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.awt.*;

@SpringBootApplication
public class ConfigurationPropertiesDemoApplication implements CommandLineRunner {

	@Autowired
	@Qualifier(value = "firstConf")
	FirstConfiguration firstConfiguration;

	@Autowired
	@Qualifier(value = "secondConfig")
	SecondConfig secondConfig;

	public static void main(String[] args) {
		SpringApplication.run(ConfigurationPropertiesDemoApplication.class, args);
	}

	@Override
	public void run(String... args) throws Exception {
		System.out.println("firstConfiguration>>>>>>>>>>>>>>>>>:");
		System.out.println(firstConfiguration.toString());
		System.out.println(firstConfiguration.getPool().getCoreSize());
		System.out.println("secondConfiguration>>>>>>>>>>>>>>>>>:");
		System.out.println(secondConfig.toString());
	}
}
